Passed
Push — dev ( 429996...7e8ed7 )
by
unknown
04:43
created

lookupConstants.ts ➔ enumToIds   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
export const ClassificationId = {
2
  AS: 1,
3
  BI: 2,
4
  CO: 3,
5
  CR: 4,
6
  CS: 5,
7
  EC: 6,
8
  EX: 7,
9
  FO: 8,
10
  IS: 9,
11
  PC: 10,
12
  PE: 11,
13
  PM: 12,
14
  AD: 13,
15
  "EN-ENG": 14,
16
  FI: 15,
17
};
18
19
export enum ReviewStatusId {
20
  ScreenedOut = 1,
21
  StillThinking = 2,
22
  StillIn = 3,
23
}
24
25
export type ReviewStatusName = "screened_out" | "still_thinking" | "still_in";
26
27
export type ReviewStatus = {
28
  id: ReviewStatusId;
29
  name: ReviewStatusName;
30
};
31
32
export enum ResponseReviewStatusId {
33
  ScreenedOut = 1,
34
  ReadyForReference = 4,
35
  ReadyToAllocate = 5,
36
  AssessmentRequired = 6,
37
  Allocated = 7,
38
  NotAvailable = 8,
39
}
40
41
export type ResponseReviewStatusName =
42
  | "screened_out"
43
  | "ready_for_reference"
44
  | "ready_to_allocate"
45
  | "assessment_required"
46
  | "allocated"
47
  | "not_available";
48
49
export type ResponseReviewStatus = {
50
  id: ResponseReviewStatusId;
51
  name: ResponseReviewStatusName;
52
};
53
54
export enum ExcludedDepartments {
55
  StrategicTalentResponse = 18,
56
}
57
58
export enum CriteriaTypeId {
59
  Essential = 1,
60
  Asset = 2,
61
}
62
63
export enum SkillTypeId {
64
  Soft = 1,
65
  Hard = 2,
66
}
67
68
export enum SkillLevelId {
69
  Basic = 1,
70
  Intermediate = 2,
71
  Advanced = 3,
72
  Expert = 4,
73
}
74
75
export enum AssessmentTypeId {
76
  NarrativeAssessment = 1,
77
  ApplicationScreeningQuestion = 2,
78
  GroupTest = 3,
79
  InformalPhoneConversation = 4,
80
  Interview = 5,
81
  OnlineExam = 6,
82
  OnSiteExam = 7,
83
  TakeHomeExam = 8,
84
  PortfolioReview = 9,
85
  ReferenceCheck = 10,
86
  SeriousGames = 11,
87
}
88
89
export const ProvinceId = {
90
  AB: 1,
91
  BC: 2,
92
  MB: 3,
93
  NL: 4,
94
  NB: 5,
95
  NS: 6,
96
  NU: 7,
97
  NT: 8,
98
  ON: 9,
99
  PE: 10,
100
  QC: 11,
101
  SK: 12,
102
  YT: 13,
103
};
104
105
export const SecurityClearanceId = {
106
  reliability: 1,
107
  secret: 2,
108
  topSecret: 3,
109
};
110
111
export const LanguageRequirementId = {
112
  english: 1,
113
  french: 2,
114
  bilingualIntermediate: 3,
115
  bilingualAdvanced: 4,
116
  englishOrFrench: 5,
117
};
118
119
export const FrequencyId = {
120
  never: 1,
121
  rarely: 2,
122
  sometimes: 3,
123
  often: 4,
124
  always: 5,
125
};
126
127
export const TravelRequirementId = {
128
  frequently: 1,
129
  available: 2,
130
  none: 3,
131
};
132
133
export const OvertimeRequirementId = {
134
  frequently: 1,
135
  available: 2,
136
  none: 3,
137
};
138
139
export const CommentTypeId = {
140
  question: 1,
141
  recommendation: 2,
142
  requiredAction: 3,
143
};
144
145
export const LocationId = {
146
  jobGeneric: "job/generic",
147
  heading: "job/heading",
148
  basicInfo: "job/basicInfo",
149
  impact: "job/impact",
150
  tasks: "job/tasks",
151
  skills: "job/skills",
152
  langRequirements: "job/langRequirements",
153
  environment: "job/environment",
154
  summary: "hr/summary",
155
  preview: "hr/preview",
156
  screeningPlan: "screeningPlan/generic",
157
  screeningPlanBuilder: "screeningPlan/builder",
158
  screeningPlanSummary: "screeningPlan/summary",
159
  screeningPlanRatings: "screeningPlan/ratings",
160
  applicantsGeneric: "applicants/generic",
161
  underConsideration: "applicants/underConsideration",
162
  optionalConsideration: "applicants/optionalConsideration",
163
  notUnderConsideration: "applicants/notUnderConsideration",
164
} as const;
165
166
export enum JobStatus {
167
  Draft = "draft",
168
  ReviewManager = "review_manager",
169
  ReviewHr = "review_hr",
170
  Translation = "translation",
171
  FinalReviewManager = "final_review_manager",
172
  FinalReviewHr = "final_review_hr",
173
  PendingApproval = "pending_approval",
174
  Approved = "approved",
175
  Ready = "ready",
176
  Live = "live",
177
  Assessment = "assessment",
178
  Completed = "completed",
179
}
180
181
export enum ResponseScreeningBuckets {
182
  Consideration = "consideration",
183
  ReadyToAllocate = "ready_to_allocate",
184
  Allocated = "allocated",
185
  Unavailable = "unavailable",
186
  DoesNotQualify = "does_not_qualify",
187
}
188
189
export const CitizenshipId = {
190
  citizen: 1,
191
  permanentResident: 2,
192
  workPermitOpen: 3,
193
  workPermitClosed: 4,
194
  notEntitled: 5,
195
};
196
197
export const VeteranId = {
198
  none: 1,
199
  current: 2,
200
  past: 3,
201
};
202
203
export const ApplicationStatusId = {
204
  draft: 1,
205
  submitted: 2,
206
  requiresAction: 3,
207
  underReview: 4,
208
  rejected: 5,
209
};
210
211
export const ApplicationStepId = {
212
  basic: 1,
213
  experience: 2,
214
  skills: 3,
215
  fit: 4,
216
  review: 5,
217
  submission: 6,
218
};
219
220
export type ApplicationStep =
221
  | "basic"
222
  | "experience"
223
  | "skills"
224
  | "fit"
225
  | "review"
226
  | "submission";
227
228
export type ProgressBarStatus = "default" | "complete" | "error" | "current";
229
230
export function getKeyByValue(object, value): string {
231
  return (
232
    Object.keys(object).find((key) => object[key] === value) ?? "key not found."
233
  );
234
}
235
236
export function enumToIds(enumType: object): number[] {
237
  const enumVals = Object.values(enumType);
238
  // Note: this first array includes the list of ids as strings, followed by the list of names as strings
239
  const enumIds = enumVals.filter((item) => !Number.isNaN(Number(item)));
240
  return enumIds.map((id) => Number(id));
241
}
242
243
export const SkillLevelIdValues = enumToIds(SkillLevelId);
244
245
export const SkillTypeIdValues = enumToIds(SkillTypeId);
246
247
export const AssessmentTypeIdValues = enumToIds(AssessmentTypeId);
248
249
export const CriteriaTypeIdValues = enumToIds(CriteriaTypeId);
250